package com.abc.cloud.service;

import com.abc.cloud.dto.count.UserFileCount;
import  com.abc.cloud.dto.file.FileCountItem;
import com.abc.cloud.vo.file.*;
import com.baomidou.mybatisplus.extension.service.IService;
import com.abc.cloud.common.utils.PageUtil;
import com.abc.cloud.entity.FileEntity;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * 文件信息表
 *
 * @author LiJunXi
 * @email 2770063826@qq.com
 * @date 2023-10-27 13:09:54
 */
public interface FileService extends IService<FileEntity> {

    PageUtil queryPage(Map<String, Object> params);

    Boolean uploadChunk(FileUpload fileUpload);

    Map<String, Object> checkChunk(FileUploadCheck fileUploadCheck);

    Boolean mergeChunks(FileMerge fileMerge, FileEntity fileEntity);

    void saveFile(FileEntity fileEntity, FileMerge fileMerge, Long userId, String fileSavePath, String suffix);

    PageUtil getFolderFile(Map<String, Object> params);

    void saveFolder(FileSave fileSave);

    void getFile(HttpServletResponse response, HttpServletRequest request, Long fileId, Long userId);

    String upload(MultipartFile file, Long userId, String username);

    void updateChildUnique(Map<String, Object> params);

    List<FileCountItem> getUserFileTypeCount(Long userId);

    void updateUserFile(Long userId, Long fileId, Integer status);

    void updateUserFile(Long userId, Integer status);

    PageUtil adminGetFileList(Map<String, Object> params);

    void adminUpdateFile(FileAdminUpdate fileAdminUpdate);

    void adminDeleteFile(List<Long> fileIds, Integer status);

    List<FileEntity> getFolderList(Map<String, Object> params);

    void updateParentUnique(Map<String, Object> params);

    void adminUpdateFileComment(Long userId, Long fileId, Integer status);

    void adminUpdateFileComment(Long userId, Integer status);

    void reduceSpace(Long fileSize, Long userId);

    void saveFileToMe(Long fileId, Long saveFileId, LocalDateTime now, String username, Long userId, Long fromUserId);

    void getFileStream(HttpServletResponse response, String filename, String filePath);

    List<UserFileCount> countUserFile(Long userId);
}

